<{include file="tpl/filter.tpl"}>
<{include file="tpl/grid.tpl"}>
	
<script>
	$(function(){
		
		//封禁
		$(document).on('click','a[name="seal_off"]',function(){
			_this = $(this);
			layer.confirm('确定封禁该角色？', {
				btn: ['确定','取消'] //按钮
				,skin: 'layui-layer-molv'
			}, function(){
				var id = _this.attr('data-id');
				banUser(id,1,_this);
			}, function(){
				//console.log('取消');
            });
		});
		
		//解封
		$(document).on('click','a[name="undo"]',function(){
			_this = $(this);
			layer.confirm('确定解封该角色？', {
				btn: ['确定','取消'] //按钮
				,skin: 'layui-layer-molv'
			}, function(){
				var id = _this.attr('data-id');
				banUser(id,0,_this);
			}, function(){
				//console.log('取消');
            });
		});
		  
	});
	
function banUser(id,actiontype,_this){
	var _this = _this;
	var g = $('input[name="g"]').val();
	var url = '?r=insidePlayer/banUser&g='+g;
	
	$.ajax({
    	type : 'POST',
    	url : url,
		data : {'id':id,'actiontype':actiontype},
		dataType :'JSON',
		success : function(res){
			if(res.status == 1){
				layer.alert(res.msg, {icon: 1, skin: 'layui-layer-molv'});
				
			}else{
			    layer.alert(res.msg, {icon: 2, skin: 'layui-layer-molv'});
			}
		}
	});
}



</script>
	


